<template>
	<view class="selfAddress">
		<view class="headTop">
			<view class="title">地址簿</view>
			<navigator class="addressBtn" url="/pages/address/add">
				+ 添加地址
			</navigator>
		</view>
		
		<view class="list" v-if="addressList.length > 0">
			<view class="item" v-for="item in addressList" @click="onClickaddress(item)">
				<view>
					<view class="head">
						<view class="user">{{item.username}},{{item.mobile}}</view>
						<view class="select">
							<u-button v-if="false" color="#EC544F" plain size="mini" text="默认地址"></u-button>
							<!-- <u-button color="#666" v-else plain size="mini" text="设为默认"></u-button> -->
						</view>
					</view>
					<view class="more">
						{{item.address}}
					</view>
				</view>
				<view class="icons">
					<view @click.stop="onEdit(item)">	<u-icon  size="20" name="edit-pen" style="margin-bottom: 10px;" ></u-icon></view>
					<view @click.stop="onDelte(item)">	<u-icon  color="red" size="20" name="trash"></u-icon></view>
				
				</view>
				

			</view>
		</view>
		<u-empty v-else mode="address">
		</u-empty>
	</view>
</template>

<script>
	import {
		mapGetters,
		mapMutations
	} from "vuex"
	export default {
		data() {
			return {
			
			};
		},
		computed: {
			...mapGetters(["addressList"])
		},
		methods: {
			...mapMutations(["setAddressItem","currentAddress"]),
			onClickaddress(item) {
				this.currentAddress(item)
				uni.navigateBack()
			},
			onEdit(item) {
				this.setAddressItem(item)
				uni.navigateTo({
					url: '/pages/address/edit'
				})
			},
			onDelte(item) {
				
			}
		}
	}
</script>

<style lang="scss">
page{
	background: $page-bg-color;
}
.selfAddress{
	padding:30rpx;
	.headTop{
		@include flex-box();
		font-size: 30rpx;
		font-weight: bold;
		.addressBtn{
			border:1px solid #000;
			border-radius: 50rpx;
			padding:6rpx 15rpx;
		}
	}
	.list{
		padding-top:30rpx;
		.item{
			display: flex;
			    justify-content: space-between;
			background: #fff;
			padding:40rpx 20rpx;
			margin-bottom: 30rpx;
			border-radius: 15rpx;
			.head{
				@include flex-box();
				font-weight: bold;
			}
			.more{
				font-size: 28rpx;
				color:$text-font-color-3;
				padding-top:10rpx;
			}
	
		}
	}
}
</style>
